'''------------------------------------------------------------------------------------------------
 $ @Author: YangShangqi
 $ @Date: 2021-12-20 17:21:18
 $ @LastEditTime: 2021-12-20 17:30:57
 $ @LastEditors: Please set LastEditors
 $ @Description: 读取yaml文件
 $ @FilePath: \YSQTrackerEvaluationToolkit\GETCFG\getCfg.py
--------------------------------------------------------------------------------------------------'''
from yacs.config import CfgNode as CN

_C = CN()
_C.videosNameList = []
_C.outputVideosList = []
_C.IV = []
_C.SV = []
_C.OCC = []
_C.DEF = []
_C.MB = []
_C.FM = []
_C.IPR = []
_C.OPR = []
_C.OV = []
_C.BC = []
_C.LR = []


'''-------------------------------------------------------------------------------------------
 * @description: 获取一个空的cfg对象
 * @param {*}
 * @return {*}
---------------------------------------------------------------------------------------------'''
def _get_cfg_def():
    return _C.clone()

'''-------------------------------------------------------------------------------------------
 * @description: 读取yaml文件中的配置
 * @param {str} yamlDir -》 yaml文件的地址
 * @param {bool} freeze -》 是否需要冻结参数。默认为冻结
 * @return {*}
---------------------------------------------------------------------------------------------'''
def getYamlCfg(yamlDir:str,freeze:bool = True)->CN:
    cfg = _get_cfg_def()
    cfg.merge_from_file(yamlDir)
    if freeze:
        cfg.freeze()
    return cfg